﻿using Hippo.Agent.Lib.ControlService;
using Hippo.Framework.Model;

namespace Hippo.Agent.Lib
{
    using System;
    using System.ServiceModel;

    public class ConsoleClient
    {
        private const string ConsoleClientBindingConfiguration = "DefaultBinding";
        private readonly HippoConsoleControlClient client;

        public ConsoleClient(InstanceContext callbackContext, IEndpointDiscovery endpointProvider)
        {
            client = new HippoConsoleControlClient(callbackContext, ConsoleClientBindingConfiguration, endpointProvider.Discover());
        }

        public void RegisterClient()
        {
            client.RegisterAgent(Environment.MachineName);
        }

        public void RegisterTestResult(TestResult testResult)
        {
            client.RegisterTestResult(testResult);
        }
    }
}
